package admin;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class Uploadrs {
	public String exe(String title,String urlrs,String code) {
		try {
			Class.forName("com.mysql.jdbc.Driver");
			Getconfig gc=new Getconfig();
			String url=gc.getParaValue("connectUrl");
			Connection conn=DriverManager.getConnection(url);
			String sql="insert into resources(title,url,code) value(?,?,?)";
			PreparedStatement ps=conn.prepareStatement(sql);
			ps.setString(1, title);
			ps.setString(2, urlrs);
			ps.setString(3, code);
			
			ps.executeUpdate();
			ps.close();
			conn.close();
			return "上传成功！";
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
			return "上传失败！";
		}
	}

}
